// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import VueResource from 'vue-resource'
Vue.use(VueResource)
//引入'element-ui
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import SIdentify from './components/views/Identify'
import { freemem } from 'os';
import Global from './api/Global'//引用文件
Vue.prototype.GLOBAL = Global;//挂载到Vue实例上面
Vue.use(SIdentify)
Vue.use(ElementUI)

Vue.config.productionTip = false
router.beforeEach((to,from,next)=>{
  if(to.meta.needLogin){
    if(window.localStorage.getItem('aname')){
      next()
    }else{
      alert('请先登录')
      next('/Login')
    }
  }else{
    next()
  }
  if(to.meta.needLogin1){
    if(window.localStorage.getItem('dname')){
      next()
  }else{
    alert('请先登录')
    next('/Login')
  }
    
  }else{
    next()
  }
}
)
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {App},
  template: '<App/>'
})
